<?php
namespace app\app\controller\v1;
use think\Model;
use app\app\util\OnlineUtils;
use think\Cache;

class PocketController extends BaseController{

	//购物车
	public function shoppingCart()
	{
		$user_id = OnlineUtils::getUserIdBySid();
		$pocket  = json_decode(input('post.pocket'));
		$store_id = json_decode(input('post.store_id'));
		$data = array('store_id'=>$store_id,'pocket'=>$pocket);
		//存缓存,命名规则以tof+shopping_cart+商户id
		$name  = config('shoppingcart').$user_id.':store='.$data['store_id'];
		$value = $data;
		$time  = 15*24*60*60;
		Cache::set($name,$value,$time);
		//取出缓存
		$result = Cache::get($name,'缓存不存在');
		return jsonReturn(200,'success',$result);
	}

}